<template>
	<view>
		<view class="share">
			<!-- 弹出背景灰色 -->
			<view :class="{'box': share}" @click="display"></view>
			<!-- 弹出部分 -->
			<view class="share-item" :class="{'show': share}">
				<view class="content">
					<view class="top">
						<view class="top-msg">
							<text>主人，我可以帮你做点儿什么吗？</text>
						</view>
						<view class="top-img">
							<view class="img">
								<image :src="img"></image>
							</view>
						</view>
					</view>
					<view class="center">
						<view class="center-con" v-for="(item,index) in listData" :key="index"
							@click="showClickFun(item)">
							<view class="img">
								<image :src="item.img"></image>
							</view>
							<view class="text">
								<view class="title">
									<text>{{item.text}}</text>
								</view>
								<view class="tips">
									<text>{{item.tips}}</text>
								</view>
							</view>
						</view>
					</view>
					<view class="bottom" @click="display">
						<view class="bottom-text">
							<text>X</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		releaseListData
	} from '@/local_data/main/my.js'

	export default {
		props: {
			//默认不弹出
			share: {
				type: Boolean,
				default: false
			},
			height: {
				type: String,
				default: '1000'
			}
		},
		data() {
			return {
				img: require('@/static/img/main/my/release-animation/09.svg'),
				listData: releaseListData
			}
		},
		methods: {
			// 隐藏分享
			display() {
				//this.share = !this.share;
				this.$emit('display', this.share)
			},
			showClickFun(item) {
				if (item.id == 1) {
					return uni.navigateTo({
						url: '/subpkg/main/my/release/release-demand/release-demand'
					})
				}
				if (item.id == 2) {
					return uni.navigateTo({
						url: '/subpkg/main/my/release/release-leave/release-leave'
					})
				}
				if (item.id == 3) {
					return uni.navigateTo({
						url: '/subpkg/main/my/release/release-help/release-help'
					})
				}
				//console.log(item)
				// if (item.id == 3) {
				// 	uni.navigateTo({
				// 		url: '/subpkg/main/release/lie-idle/lie-idle'
				// 	})
				// }
			}
		}
	}
</script>

<style lang="scss" scoped>
	.share {
		width: 100%;
		height: 100%;
		position: relative;
		// z-index: 1;
	}

	//背景色（黑色透明40%）
	.box {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0rpx;
		left: 0rpx;
		bottom: 0rpx;
		right: 0rpx;
		background-color: rgba(0, 0, 0, 0.4);
		transition: .3s;
		z-index: 999;
	}

	// 进入分享动画
	.show {
		transition: all 0.3s ease;
		transform: translateY(0%) !important;
	}

	// 离开分享动画
	.share-item {
		position: fixed;
		bottom: 0;
		left: 10%;
		width: 80%;
		margin-bottom: 0;
		height: 1000rpx;
		//height: 1000rpx;
		// background-color: #FFFFFF;

		transition: all 0.3s ease;
		transform: translateY(100%);
		z-index: 999;
	}

	.content {
		.top {
			.top-msg {
				height: 80rpx;
				border-radius: 30rpx;
				background-color: rgba(255, 219, 184, 1);
				line-height: 80rpx;
				font-size: 28rpx;

				text {
					margin-left: 30rpx;
					color: rgba(245, 129, 12, 1);
				}

			}

			.top-img {
				// width: 60%;
				// margin-left: 20%;
				// display: flex;
				text-align: center;

				image {
					width: 200rpx;
					height: 200rpx;
				}
			}
		}

		.center {
			.center-con {

				width: 100%;
				height: 80rpx;
				background-color: #fff;
				border-radius: 60rpx;
				display: flex;
				// margin-bottom: 30rpx;
				padding: 10rpx 0;
				margin: 40rpx 0;

				&:active {
					background-color: #eee;
				}

				.img {
					// margin-left: 30%;

					image {
						margin: 20rpx 5rpx 20rpx 30rpx;
						margin-top: 20rpx;
						width: 60rpx;
						height: 60rpx;
					}
				}

				.text {

					.title {
						font-size: 34rpx;
						height: 50rpx;
						line-height: 50rpx;
					}

					.tips {
						font-size: 20rpx;
						height: 50rpx;
						line-height: 25rpx;
						color: #BEBCBD;

						text {
							display: -webkit-box;
							/** 对象作为伸缩盒子模型显示 **/
							overflow: hidden;
							word-break: break-all;
							/* break-all(允许在单词内换行。) https://www.w3school.com.cn/cssref/pr_word-break.asp*/
							text-overflow: ellipsis;
							/* 超出部分省略号 */
							-webkit-box-orient: vertical;
							/** 设置或检索伸缩盒对象的子元素的排列方式 **/
							-webkit-line-clamp: 1;
							/** 显示的行数 **/
						}
					}
				}
			}
		}

		.bottom {
			margin-top: 50rpx;

			.bottom-text {

				text-align: center;
				line-height: 80rpx;
				border-radius: 30rpx;

				text {

					border-radius: 30rpx;
					padding: 15rpx 30rpx;
					background: #fff;
					font-size: 40rpx;
					color: rgba(67, 207, 124, 1);

				}
			}
		}
	}
</style>